package cool.taomu.toolkit.retry

import com.google.auto.service.AutoService
import com.google.inject.AbstractModule
import com.google.inject.matcher.Matchers
import cool.taomu.toolkit.TaomuConfigure
import cool.taomu.toolkit.platform.inter.IPlatform

@AutoService(IPlatform)
class RetryPlugin implements IPlatform {

    override note() {
        "Retry 插件"
    }

    override packages() {
    }

    override module(TaomuConfigure config) {
        new AbstractModule() {
            override configure() {
                var interceptor = new RetryInterceptor();
                requestInjection(interceptor);
                bindInterceptor(
                    Matchers.any(),
                    Matchers.annotatedWith(Retry),
                    interceptor
                );
            }
        }
    }

    override start() {
    }

    override init() {
    }

}
